clear all
clc
r=3; 
%javaaddpath('C:\Program Files\Weka-3-6\weka.jar') %for Masahiro probablly for MJ, too
javaaddpath('/Applications/weka-3-6-10/weka.jar')%for Ben
load('vehicles_short.mat')
learner_name='trees.RandomForest';
learner_options='-I 10 -K 0 -S 1';
meta_name='meta.AdaBoostM1';
meta_options='-P 100 -S 1 -I 10 -W ';
if strcmp(meta_name,'')==0
    options=[meta_options,'weka.classifiers.',learner_name,' ',learner_options,''];
    name=meta_name;
else
    options=learner_options;
    name=learner_name;
end
name='functions.SMO';
options='-C 1.0 -L 0.001 -P 1.0E-12 -N 0 -V -1 -W 1 -K "weka.classifiers.functions.supportVector.PolyKernel -C 250007 -E 1.0"';
options=weka.core.Utils.splitOptions(options);
angle_results=KFold_trial(vehicles, 'angle', name, options, r);
disp(sprintf('\n\n Angle Classification Confusion Matrix:\n'))
plotResults(angle_results, 'angle')
title('Angle Classification Results')

front=[];
side=[];
back=[];
for i=1:size(vehicles, 2)
    if vehicles(i).camera_angle(1)=='f'
        front(end+1)=i;
    elseif vehicles(i).camera_angle(1)=='s'
        side(end+1)=i;
    elseif vehicles(i).camera_angle(1)=='b'
        back(end+1)=i;
    end
end

front_results=KFold_trial(vehicles(front), 'type', name, options, r);
disp(sprintf('\n\n Type Classification Confusion Matrix: Front\n'))
plotResults(front_results, 'type')
title('Vehicle Classification Results for Front Images Only')

side_results=KFold_trial(vehicles(side), 'type', name, options, r);
disp(sprintf('\n\n Type Classification Confusion Matrix: Side\n'))
plotResults(side_results, 'type')
title('Vehicle Classification Results for Side Images Only')

back_results=KFold_trial(vehicles(back), 'type', name, options, r);
disp(sprintf('\n\n Type Classification Confusion Matrix: Back\n'))
plotResults(back_results, 'type')
title('Vehicle Classification Results for Rear Images Only')

